package k3_IO.p2_fileStream.demo01;

import java.io.*;

public class PrintOutputStream {

    public static void printStream() throws Exception{
        //是一个处理流，也需要基于节点流，节点流的方式可以是字符串，File 或者是OutputStream
        PrintStream ps = new PrintStream("E://print.txt");
        ps.println(true);
        ps.println(1000);
        ps.println(3.14);
        ps.print("hello world");

        ps.close();
    }

    public static void printWriter() throws Exception {

        PrintWriter pw = new PrintWriter(new FileOutputStream("E://print.txt",true));
        pw.println("hahaha");
        pw.println(10000);

        pw.close();

    }

    public static void main(String[] args) throws Exception {
        PrintOutputStream.printStream();
        PrintOutputStream.printWriter();
    }

}
